Round for reround mode in a decimal floating point instruction

ABSTRACT

A round-for-reround mode (preferably in a BID encoded Decimal format) of a floating point instruction prepares a result for later rounding to a variable number of digits by detecting that the least significant digit may be a 0, and if so changing it to 1 when the trailing digits are not all 0. A subsequent reround instruction is then able to round the result to any number of digits at least 2 fewer than the number of digits of the result. An optional embodiment saves a tag indicating the fact that the low order digit of the result is 0 or 5 if the trailing bits are non-zero in a tag field rather than modify the result. Another optional embodiment also saves a half-way-and-above indicator when the trailing digits represent a decimal with a most significant digit having a value of 5. An optional subsequent reround instruction is able to round the result to any number of digits fewer or equal to the number of digits of the result using the saved tags.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of application Ser. No. 15/852,180,filed Dec. 22, 2017, set to issue as U.S. Pat. No. 10,127,014, which isa continuation of application Ser. No. 15/470,692, filed Mar. 27, 2017,now U.S. Pat. No. 9,851,946, which is a continuation of application Ser.No. 14/943,254, filed Nov. 17, 2015, now U.S. Pat. No. 9,690,544, whichis a continuation of application Ser. No. 13/848,885, filed Mar. 22,2013, now U.S. Pat. No. 9,201,846, which is a continuation ofapplication Ser. No. 11/680,894, filed Mar. 1, 2007, now U.S. Pat. No.8,443,029, all of which applications and patents are incorporated hereinby reference.

FIELD OF THE INVENTION

The present invention is related computer systems and, more particularlyto rounding floating point coefficients to a selected precision.

BACKGROUND OF THE INVENTION

U.S. patent application Ser. No. 10/930,129 (Schwarz et al.) “DecimalRounding Mode which Preserves Data Information For Further Rounding toLess Precision” filed Aug. 31, 2004 and incorporated herein by referencedescribes a new rounding mode called “round for reround” on the originalarithmetic instruction in the hardware precision, and then 2) invokingan instruction which specifies a variable rounding precision andpossibly explicitly sets the rounding mode which we have called theReRound instruction. The precise result of the arithmetic operation isfirst truncated to the hardware format precision “p”, forming anintermediate result. If only zeros are dropped during truncation, thenthe intermediate result is equal to the precise result, and this resultis said to be “exact”, otherwise, it is “inexact”. When the intermediateresult is inexact and its least significant digit is either zero orfive, then that digit is incremented to one or six respectively formingthe rounded result. Thus, when the least significant digit of a roundedresult is zero or five the result could be construed to be exact orexactly halfway between two machine representations if it were laterrounded to one less digit of precision. For all other values, it isobvious that the result is inexact and not halfway between two machinerepresentations for later roundings to fewer than “p” digits ofprecision. A nice mathematical property of this rounding mode is thatresults stay ordered and in a hardware implementation it is guaranteedthat the incrementation of the least significant digit does not cause acarry into the next digit of the result.

In the Schwarz application a first requirement is to create aninstruction which rounds to a user specified precision which isvariable, which we call the “ReRound” instruction. And the secondrequirement is that the original arithmetic operation in the higherprecision somehow maintains information about the infinitely preciseintermediate result. This information is used to prevent incorrectdouble rounding and enables the hardware to construct an equivalentoperand, which when rounded to a smaller precision using the ReRoundinstruction, produces the same result as if rounding the originalinfinitely precise operand. Prior methods for maintaining thisinformation about the infinitely precise result have included recordingin a status word whether the rounded target is inexact and in a fewcases some architectures have also provided a bit indicating whether itwas rounded up. This allows rounding of a “p” digit result to a “p−1” orless digits of precision. One other method previously mentioned is toonly round to only “((p/2)−1)” where “p” is the precision of the targetof an arithmetic operation (i.e. 7, 16 or 34 digits depending onhardware format chosen). Choosing to limit the rounding capabilities toless than half the machine precision is severely limiting. And using thestatus word to maintain the additional information creates a bottleneckfor performance.

The Schwarz application eliminates the performance bottleneck ofupdating and reading the floating-point status word of priorapplications and provides the capability of secondary roundings up to“p−1” digits of precision where the first rounding was to “p” digits ofprecision. The mechanism for providing this information is to create anew rounding mode which maintains this information within the result ofthe first rounded result which was rounded to the hardware formatprecision. This rounding mode creates a result which will roundequivalently to “p−1” digits or less of precision as the originalinfinitely precise result. By doing this, the extra information iscontained completely within the operand and there is no bottleneck inusing the floating-point status word. And given that the information iscontained within the operand, multiple independent operations can beplaced in between these two instructions (the original arithmeticinstruction to hardware precision and the subsequent rerounding tolesser precision).

The Schwarz application provides a new rounding mode called “round forreround”. The precise result of the arithmetic operation is firsttruncated to the hardware format precision “p”, forming an intermediateresult. If only zeros are dropped during truncation, then theintermediate result is equal to the precise result, and this result issaid to be “exact”, otherwise, it is “inexact”. When the intermediateresult is inexact and its least significant digit is either zero orfive, then that digit is incremented to one or six respectively formingthe rounded result. Thus, when the least significant digit of a roundedresult is zero or five the result could be construed to be exact orexactly halfway between two machine representations if it were laterrounded to one less digit of precision. For all other values, it isobvious that the result is inexact and not halfway between two machinerepresentations for later roundings to fewer than “p” digits ofprecision. A nice mathematical property of this rounding mode is thatresults stay ordered and in a hardware implementation it is guaranteedthat the incrementation of the least significant digit does not cause acarry into the next digit of the result.

An example of the problem is shown when one wishes to multiply twooperands in a 16 digit hardware format but later round the answer to 15digits in rounding mode where the operand is rounded to the nearestrepresentable number in the target format and in case of a tie isrounded to the lower magnitude. One could also call this rounding moderound half down).

In the example, employing a decimal multiply intermediate product, say1.23456789012344500111

If the decimal multiply were rounded toward zero the 16 digit resultwould be 1.234567890123445 and then applying an instruction to reroundto 15 digits would yield 1.23456789012344 which is a wrong result.

U.S. Pat. No. 4,823,260 (to Imel et al.) “MIXED-PRECISION FLOATING POINTOPERATIONS FROM A SINGLE INSTRUCTION OPCODE” filed Nov. 12, 1987 andincorporated herein by reference provides for performing mixed precisioncalculations in the floating point unit of a microprocessor from asingle instruction opcode. 80-bit floating-point registers) may bespecified as the source or destination address of a floating-pointinstruction. When the address range of the destination indicates that afloating point register is addressed, the result of that operation isnot rounded to the precision specified by the instruction, but isrounded to extended 80-bit precision and loaded into the floating pointregister. When the address range of the source indicates that an FPregister is addressed, the data is loaded from the FP register inextended precision, regardless of the precision specified by theinstruction. In this way, real and long-real operations can be made touse extended precision numbers without explicitly specifying that in theopcode.

The Intel iAPX 286/20 Numeric Data Processor (NDP) has a floating pointinstruction set that supports the IEEE Microprocessor Floating PointStandard P754. The NDP has eight 80-bit floating point registers whichprovide a capacity equivalent to forty 16-bit registers. Two 16-bitregisters control and report the results of numeric instructions. Acontrol word register defines the rounding, infinity, precision, anderror-mask controls required by the IEEE standard. In order toaccommodate extended-precision floating point calculations, the NDPsupports 32-bit, 64-bit, and 80-bit real values. The 80-bit real valuesare used internally by the eight 80-bit floating point registers forextremely high precision calculations. To implement this arithmeticcapability requires a separate opcode for each instruction whichspecifies a floating-point data type. This results in a number ofseparate opcodes in order to achieve all possible combinations offloating-point data types. Extra conversion instructions are necessaryto convert and round the extended real result to the desired destinationformat with double rounding. It is desirable to reduce the number offloating point operations in order to simplify the programming andincrease the performance of floating-point operations. The Imel patentprovides an apparatus for performing a number of kinds of mixedprecision calculations in the floating point unit of a microprocessorutilizing a single instruction opcode.

U.S. Pat. No. 6,108,772 “METHOD AND APPARATUS FOR SUPPORTING MULTIPLEFLOATING POINT PROCESSING MODELS” filed Jun. 28, 1996 and incorporatedherein by reference discloses a numerical processing method on acomputer system in which an instruction having at least one operand anda type control is retrieved, and the operand is converted to a precisionspecified by the type control. The instruction is executed in theprecision specified by the type control to obtain a result, and when thedestination precision differs from the precision specified by the typecontrol, the result is converted to the destination precision using asecond instruction.

A method is needed to permit rounding decimal floating point numbers toa variable precision that results in a precise result.

SUMMARY OF THE INVENTION

The present invention provides for preparing a Decimal Floating PointBID encoded result of an instruction execution for rounding to avariable precision value. An instruction employing the inventionexecutes a round-for-reround mode that detects if the result formed froman intermediate result has a least significant bit value of 0 and thatthe trailing portion (to be truncated off) has a value greater than 1and when those conditions are met, a flag is set when the result isexact. Two means are proposed. The first sets the low order bit of theresult to 1 such that any subsequent reround to at least 2 fewer decimaldigits can be performed because it is guaranteed that the leastsignificant decimal digit is not 0 (however the least significantdecimal digit might still be 5 exact or inexact so the reround cannotsafely reround to 1 fewer digits).

In another embodiment, a test is performed in the round-for-reround modefor a least significant digit being 0 or 5 and the trailing digits beinggreater than 0 to set a first flag. If the value of the trailing digitsis a half-way-and-above value setting a second flag but. The tag bitsare saved in one of a plurality of registers associated with a FPR of aplurality of Floating Point Registers. In this case the result portionof the intermediate portion is not modified before storing it as aresult because the needed information is saved in the tag fields. Asubsequent reround instruction uses these flag bits to reround theresulting operand to a variable number of digits less than or equal tothe number of digits of the source operand.

It is therefore an object of the invention to execute a decimal floatingpoint instruction configured to perform a decimal floating pointoperation, the decimal floating point instruction configured to utilizea round-for-reround mode, the executing step comprising the steps ofproducing an intermediate result of the executed decimal floating pointoperation, the intermediate result having a high order portion and a loworder portion, the high order portion corresponding to a hardwareformat, the hardware format having a first number of digits of precisionincluding a least significant digit. Then, rounding the high orderportion according to the round-for-reround mode, wherein the roundingstep comprises the step of, if the least significant bit of the highorder portion is 0 and if the value of the low order portion is greaterthan 0, changing the least significant bit of said high order portion to1 to form a to-be-stored high order portion. If the least significantbit of the high order portion of the intermediate result produced instep 1) is 1, or if the value of the low order portion of saidintermediate result produced in step 1) is 0, leaving the leastsignificant digit of said high order portion unchanged to form saidto-be-stored high order portion. Then storing the to-be-stored highorder portion as a final result of the executed decimal floating pointoperation.

It is further an object of the invention to, subsequent to execution ofthe decimal floating point instruction, executing a decimal reroundinstruction, the decimal reround instruction configured to round adecimal floating point number to any of a plurality of roundingprecisions, the step of executing the decimal reround instructionexecution comprising the steps of fetching the stored final result ofthe executed decimal floating point operation, the fetched final resulthaving a first number of bits representing a first number of decimaldigits. Then determining a decimal reround instruction specifiedrounding precision of the plurality of rounding precisions, wherein thespecified rounding precision employs a second number of digitsconsisting of two or more fewer digits than the first number of digits.Then rounding the fetched final result to the second number of digitsspecified by the decimal reround interaction. And storing the roundedfinal result of the executed decimal floating point operation as aresult of the decimal reround instruction.

The above as well as additional objectives, features, and advantages ofthe present invention will become apparent in the following writtendescription.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram depicting components of an example prior artcomputer system;

FIG. 2 depicts an example network of computer systems according to theprior art;

FIG. 3 is a table depicting the prior art DPD coding scheme;

FIG. 4 is a diagram representing operation of an exampleround-for-reround instruction;

FIG. 5 depicts an example execution using the round-for-reround mode;

FIG. 6 depicts execution of a reround instruction;

FIG. 7 depicts an embodiment of a round-for-reround instructionemploying Floating Point Register tags (pF); and

FIG. 8 depicts execution of a reround instruction using the pF tags.

DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 illustrates a representative workstation or server hardwaresystem in which the present invention may be practiced. The system 100of FIG. 1 comprises a representative computer system 101, such as apersonal computer, a workstation or a server, including optionalperipheral devices. The workstation 101 includes one or more processors106 and a bus employed to connect and enable communication between theprocessor(s) 106 and the other components of the system 101 inaccordance with known techniques. The bus connects the processor 106 tomemory 105 and long-term storage 107 which can include a hard drive,diskette drive or tape drive for example. The system 101 might alsoinclude a user interface adapter, which connects the microprocessor 106via the bus to one or more interface devices, such as a keyboard 104,mouse 103, a Printer/scanner 110 and/or other interface devices, whichcan be any user interface device, such as a touch sensitive screen,digitized entry pad, etc. The bus also connects a display device 102,such as an LCD screen or monitor, to the microprocessor 106 via adisplay adapter.

More particularly, machine instructions of the present invention can beused with a computer architecture with existing instruction formats.These computer architected instructions comprise computer software,stored in a computer storage medium, for producing the code running ofthe processor utilizing the computer software, and comprising theinstruction code for use by a compiler or emulator/interpreter which isstored in a computer storage medium, and wherein the first part of theinstruction code comprises an operation code which specified theoperation to be performed and a second part which designates theoperands for that participate.

The system 101 may communicate with other computers or networks ofcomputers by way of a network adapter capable of communicating 108 witha network 109. Example network adapters are communications channels,token ring, Ethernet or modems. Alternatively, the workstation 101 maycommunicate using a wireless interface, such as a CDPD (cellular digitalpacket data) card. The workstation 101 may be associated with such othercomputers in a Local Area Network (LAN) or a Wide Area Network (WAN), orthe workstation 101 can be a client in a client/server arrangement withanother computer, etc. All of these configurations, as well as theappropriate communications hardware and software, are known in the art.

FIG. 2 illustrates a data processing network 200 in which the presentinvention may be practiced. The data processing network 200 may includea plurality of individual networks, such as a wireless network and awired network, each of which may include a plurality of individualworkstations 101 201 202 203 204. Additionally, as those skilled in theart will appreciate, one or more LANs may be included, where a LAN maycomprise a plurality of intelligent workstations coupled to a hostprocessor.

Still referring to FIG. 2, the networks may also include mainframecomputers or servers, such as a gateway computer (client server 206) orapplication server (remote server 208 which may access a data repositoryand may also be accessed directly from a workstation 205). A gatewaycomputer 206 serves as a point of entry into each network 207. A gatewayis needed when connecting one networking protocol to another. Thegateway 206 may be preferably coupled to another network (the Internet207 for example) by means of a communications link. The gateway 206 mayalso be directly coupled to one or more workstations 101 201 202 203 204using a communications link. The gateway computer may be implementedutilizing an IBM eServer zSeries® 900 Server available from IBM Corp.

Software programming code which embodies the present invention istypically accessed by the processor 106 of the system 101 from long-termstorage media 107, such as a CD-ROM drive or hard drive. The softwareprogramming code may be embodied on any of a variety of known media foruse with a data processing system, such as a diskette, hard drive, orCD-ROM. The code may be distributed on such media, or may be distributedto users 210 211 from the memory or storage of one computer system overa network to other computer systems for use by users of such othersystems.

Alternatively, the programming code 111 may be embodied in the memory105, and accessed by the processor 106 using the processor bus. Suchprogramming code includes an operating system which controls thefunction and interaction of the various computer components and one ormore application programs 112. Program code is normally paged from densestorage media 107 to high speed memory 105 where it is available forprocessing by the processor 106. The techniques and methods forembodying software programming code in memory, on physical media, and/ordistributing software code via networks are well known and will not befurther discussed herein.

The present invention may be practiced within a single computer oracross a network of cooperating computers.

Floating point numbers are typically represented in a computer systemusing a sign, an exponent, and a significand. The significand representsthe number of bits of precision of the number. The exponent defines therange of the number, and is bounded by the values Emax (maximumexponent) and Emin (minimum exponent). The sign represents the sign ofthe number, either positive or negative. Using these three fields,floating point numbers are represented in the form(−1)^(s)2^(E)(b ₀ ·b ₁ b ₂ b ₃ ·b _(p-1))where:

s=the sign bit, 0 or 1

E=the exponent, any integer between Emin and Emax, inclusive

bi=a significand bit, 0 or 1

p=number of significand bits (precision)

.=implied decimal point

A floating point number has p bits of precision in the significandfield, b₀·b₁ b₂ b₃·b_(p-1), which represent the number's significantdigits. (The term ‘significand’ is analogous to the term ‘mantissa’ usedto describe floating-point numbers on some conventional computers). Theexponent field, E, locates the binary point within the significantdigits (and therefore determines the number's magnitude). The term‘exponent’ is analogous to the term ‘characteristic’ used to describefloating-point numbers on some conventional computers. The decimal pointis not explicitly stored in the number, although its position isimplied. Also, the significand bit b0 to the left of the decimal pointmay be implied as well. A 1-bit sign field, s, indicates whether thenumber is positive or negative. Negative numbers differ from positivenumbers only in the sign bits of their significands.

For example, the number −260.00 can be represented as: 1 0000100000000100000000000000000 where the sign bit is 1 (indicating a negativenumber), the exponent is 00001000 (8₂), and the significand is1.00000100000000000000000, where the leading 1 and decimal point areimplicit.

TABLE 1 Single Double Extended Total Format 32 64 80 Width p (bits ofprecision) 23 53 64 Exponent bits 8 11 15 Emax +127 +1023 +16383 Emin−126 −1022 −16382 Exponent Bias +127 +1023 +16383

Table 1 describes the fields of each of three real-number formats;single, double, and extended.

The exponent determines a real number's magnitude. The exponent istypically stored in a biased form. A constant, called the bias, is addedto the true exponent of the number to obtain a biased exponent. The biasis different for each real format. The bias is chosen so as to force thebiased exponent to be a positive value. A number's true exponent can bedetermined simply by subtracting the bias value of its format from theexponent.

When a numeric value becomes very close to zero, normalizedfloating-point storage cannot be used to express the value accurately. Anumber R is said to be denormal when −2Emin<R. to accommodate denormalnumbers, the processor can store and operate on real numbers that arenot normalized, i.e., whose significands contain one or more leadingzeros. Denormal numbers typically arise when the result of a calculationyields a value that is too small to represent in the destination format.

Denormal values have the following properties:

The biased floating-point exponent is stored at its smallest value. Forsingle precision numbers, this minimum exponent value is −126. Fordouble precision, the minimum exponent value is −1022. For the extendedprecision format, the minimum exponent value is −16382.

For all formats, when the number is denormal the minimum exponent isencoded with a bit pattern of all zeros.

The integer bit of the significand (whether explicit or implicit) iszero.

Interpretation of the exponent for denormal numbers differs from theinterpretation of the exponent encoding for normalized numbers. Fordenormalized numbers, the exponent is encoded with the bit pattern ofall zeros. However, this pattern is interpreted by the processor to havea value which is the minimum exponent value for the format (which is−126 for single format, −1022 for double real format, and −16382 for theextended real format). Hence, interpreting such denormal numbers bymerely adding the bias of the format to the exponent encoding of thedenormal number will produce an exponent value that is off by one.Denormals and true zeros both have exponents encoded with all zeros,although the interpretation of these encodings differ.

Numeric Computation Rules:

To achieve consistent and reliable results from the computation, certainrules or conventions (relating to the operating precision and range ofeach computation) must be followed during numeric operations. Rules aredefined for handling operands of mixed precision, and for thecomputation of intermediate values. IEEE standard 754-1985 allows fortwo important conventions for handling operands with mixed precisions,and for intermediate computations. These will be henceforth referred toas:

“Compute in Extended Precision”

“Compute in Destination Precision”

The detailed computation rules specified in the IEEE standard 754-1985will not all be repeated here, and may be found in the officialdocument. However, a short summary of the distinguishing characteristicsis provided below.

Summary of the “Compute in Extended Precision” Convention

Under this convention, all intermediate values are computed toapproximately infinite precision (commonly approximated by the extendedprecision format which must have at least 64 bits of precision) beforeentering into the final computation of the result. The result is thencoerced to the destination format.

For example, consider the numerical operation:A=B*C+D*Ewhere A, B, C, D, E are all defined to be double-precision values. LetI1=B*C, let I2=D*E, and let I3=I1+I2

In the above example, all variables B, C, D, and E are first promoted tothe extended precision format (no information is lost in promoting avariable to a wider format). Intermediate values I1 and I2 arecalculated by performing the multiplications for B*C as well as for D*Ein extended precision, so that I1 and I2 contain 64 bits of precision.The sum of I1 and I2 is also computed in extended precision to generateI3. Finally I3 is coerced to the double precision format by a roundingand precision conversion operation.

This convention is used by the floating point units and mathcoprocessors for the x86 family of processors manufactured by INTEL®Corp. The advantage of this convention is that intermediate values arecomputed with additional precision and range, which enhances theprecision, reliability and integrity of the final result. The enhancedrange on intermediate values often eliminates overflows and underflowsthat could have occurred on the intermediate calculations but would nothave been significant for the final result.

In an exemplary processor such as those manufactured by Intel Corp, theextended precision format contains 64 bits of precision, and theexponent range is 15 bits. The coercion of the intermediate value I3from extended precision to the final result in the destination precisionis performed by a store instruction, which also saves the final resultto memory. This store instruction is complicated by the necessity to notonly store the result to memory, but also convert to the destinationprecision, including rounding of the value and checking for overflow orunderflow which may accompany the conversion, and possibly denormalizingthe result to the destination format. The hardware for implementing thestore instruction requires a rounding circuit, a range-checking andcompression circuit, a denormalizer, as well as circuitry for actuallytransferring the value to memory. Thus considerable complexities must beincurred on the store path in order to deliver the benefits of computingin a wider precision.

Summary of the “Compute in Destination Precision” Convention:

Under this convention, which is followed by many commercial ReducedInstruction Set (RISC) processors, all intermediate values are computedin the precision of the destination variable, rather than being computedin a wider format.

For example, consider again the numerical operation:A=B*C+D*Ewhere A, B, C, D, E are all defined to be double-precision values. LetI1=B*C, and let I2=D*E.

Using this convention, the intermediate results I1 and I2 are computedin double precision. The double-precision final result A is simplycomputed as I1+I2, without any additional rounding or conversion,because both intermediate values I1 and I2 are also double precision.

The advantage of this convention is that computations are typicallyfaster and require less hardware to implement. Arithmetic involving 64bit operands (extended) is typically slower than arithmetic involving 53bit operands (double). Also, since intermediate values are computed inthe final destination precision, no additional conversion and roundingoperations must be executed to reach the destination precision, furtherimproving the speed of the calculation.

The disadvantage of this method is the lost precision and range onintermediate values. This loss results in an accumulation of round offerrors and the potential for additional overflows and underflows duringintermediate calculations. Round off accumulation leads to a loss ofintegrity in the final result, and the overflows and underflows (whenthey occur) lead to reduced performance. Improvements needed

Decimal floating point rounding to variable precision is useful forfinancial applications run on microprocessor based computer processingsystems, and will be seen to be an improvement to the now standard IEEE754 Floating Point. It can be proved that a system can round to “p”digits of precision a result that was previously rounded to “2p+2”digits of precision without causing double rounding errors. The currentIEEE 754 binary floating point standard defines the significands ofsingle, double, and a proposed quad word format such that this criteriais met (24, 53, and 113 bits in each format). Each format is greaterthan a little over twice the width of the next smaller precision. Therehas been developed a current IEEE754 revision developed by a committeewhich has agreed on decimal floating-point formats of 7, 16, and 34digits which also satisfy this requirement. When we considered thisdevelopment we wondered how can a computer system be developed where auser can run applications which round to 10 digits accurately, forexample, if the original arithmetic operation were rounded to 16 digits.Such an application would now meet the revised requirement, one whichdoes not meet this criteria.

The problem is to perform the arithmetic operation and subsequentrounding as if only one rounding were performed on an infinitely preciseintermediate result. Prior art comprised maintaining the intermediateresult to infinite precision and performing rounding to the targetprecision on it. This proved to be prohibitive in terms of hardware tomaintain the intermediate result or slow, and there could be very littleseparation of the arithmetic operation and the rounding step. Anotherpossible method is to use flag bits in the floating-point status wordthat indicated inexactness and truncating the arithmetic operationfollowed by a special instruction which looked at the flag bit. Thiswould require no separation of the arithmetic operation from therounding instruction and required the resetting of the inexact flagwhich gets set by all arithmetic instructions. The Schwarz prior artallowed separation of the arithmetic operation from the shorterprecision rounding operation without using a bottlenecked register likethe floating-point status word. Instead the result of the arithmeticoperation in the register file was rounded to make equivalentrepresentation that rounded equivalent to the infinite precise result.

The Schwarz method is useful for DPD format which is a BCD like format,but it is not as easy to implement if the format is the INTEL® BIDformat. Incrementing a result with a 0 or 5 in the least significantdigit may result in propagating a carry the whole length of the integercoefficient. Take for instance the number 16777215 base 10 is equalFFFFFF base 16 and when incremented will propagate its whole length. So,in an integer format it is possible that the prior art method may beused but it causes an expense in the rounding requiring a full lengthincrementation.

For the BID format, to eliminate the need for full propagation of thecarry, a different rounding mode is proposed for decimal integer format.The new rounding mode consists of logically ORing a signal indicatingthe inexactness of the intermediate result with the least significantbit. Though with this rounding mode, rounding is supported efficientlyto P−2 digits or less instead of P−1. This new rounding effectivelyhelps perturb a least significant zero digit but does not perturb aleast significant digit of 5 in the coefficient, therefore one lessdigit can be rounded to tell whether there is an exact half way casebetween two representations. This new rounding mode can be coupled witha ReRound instruction (as proposed in the Schwarz application) which cansubsequently round the result of the arithmetic operation to the desiredprecision as long as it is 2 digits or more less than the hardwareprecision.

According to the IEEE 754R Floating Point standard DPD format, a set of3 decimal digits d0:d2 are encoded into a 10 bit format consisting ofbits b0:b9. When the value of all 3 decimal digits is less than 8, thedecimal digits are encoded in binary form wherein d0 is encoded in b0:2,d1 is encoded in b3:b5 and d2 is encoded in b7-b9. b6 is set to 0 toindicate that all 3 digits are less than 8 and therefore, fit into the 3bit binary forms. When a decimal digit is greater than 7, b6 is set to 1and various other binary bits (bx) indicate that the correspondingencoding represents the decimal digit values greater than 7. In allcases, b9 is the least significant bit of the third decimal digitencoding. Thus, by setting b9 to 1, it is assured that the value of eachcorresponding value of the decimal digit is greater than 0. Furthermore,it is assured that any set of 3 decimal representations having a 5followed by one or more 0's, the set is greater than 50 or 500. For thecase where the least significant decimal digit is 5 (wherein b6 is 0),one might set b8 (of b7:b9) to 1 to assure that the resulting decimaldigit is greater than 5.

In the IEEE 754R Floating Point standard, Binary Integer Decimal formatabbreviated by BID is a format which represents the coefficient as abinary integer rather than using a format based on Binary Coded Decimal(BCD). For 64 bit decimal format with BID encoding, there is a 1 bitsign, 5 bit combination field, an 8 bit exponent continuation field, anda 50 bit coefficient continuation field similar to DPD encoding. Theretwo differences between the BID and DPD encodings: 1) the encoding ofthe coefficient, and 2) the ordering of the combination and exponentcontinuation fields which is not detailed. The encoding of thecoefficient for BID is a binary integer representation of the 4coefficient bits extracted from the 5 bit combination field concatenatedwith the 50 bit coefficient continuation field for a total of 54 bits.Any value of the 54 coefficient bits greater than or equal to 10¹⁶ istreated as a value of zero. DPD encoding of the coefficient continuationfield is a compressed BCD format which takes 3 BCD which would normallyrequire 12 bits to represent and encodes them into 10 bits. BID encodingof the coefficient is in binary and DPD encodes the coefficient in acompressed BCD format. Binary is efficient for high-order arithmeticoperations while DPD is efficient for extracting digits and convertingto and from BCD databases.

According to IBM principles of operation document “PreliminaryDecimal-Floating-Point Architecture” SA23-2232-00 published November2006 and incorporated herein by reference, a coefficient continuationfield of the decimal floating-point data format is encoded using DenselyPacked Decimal (DPD). DPD encoding is a compression technique whichsupports the representation of decimal integers of arbitrary length.Translation operates on three Binary Coded Decimal (BCD) digits at atime compressing the 12 bits into 10 bits with an algorithm that can beapplied or reversed using simple Boolean operations. In the followingexamples, a 3-digit BCD number is represented as (abcd)(efgh)(ijkm), a10-bit DPD number is represented as (pqr)(stu)(v)(wxy), and the Booleanoperations, & (AND), | (OR), and ¬ (NOT) are used. BCD-to-DPDTranslation

The translation from a 3-digit BCD number to a 10-bit DPD can beperformed through the following Boolean operations.p=(a&f&i)|(a&j)|bq=(a&g&i)|(a&k)|cr=ds=(¬a&e&j)|(f&¬i)|(¬a&f)|(e&i)t=(¬a&e&k)|(a&i)|gu=hv=a|e|iw=(¬e&j)|(e&i)|ax=(¬a&k)|(a&i)|ey=mDPD-to-BCD Translation

The translation from a 10-bit DPD to a 3-digit BCD number can beperformed through the following Boolean operations.a=(¬s&v&w)|(t&v&w&x)|(v&w&¬x)b=(p&s&x)|(p&¬w)|(p&¬w)c=(q&s&x)|(q&¬w)|(q&¬w)d=re=(t&v&¬w&x)|(s&v&w&x)|(¬t&v&x)f=(p&t&v&w&x)|(s&¬x)|(s&¬w)g=(q&t&w)|(t&¬x)|(t&¬v)h=ui=(t&v&w&x)|(s&v&w&x)|(v&¬w&¬x)j=(p&¬s&¬t&w)|(s&v&¬w&x)|(p&w&¬x)|(¬v&w)k=(q&¬s&¬t&v&w)|(q&v&w&¬x)|(t&v&¬w&x)|(¬w&x)m=y

Alternatively, the Table shown in FIG. 3 can be used to perform thetranslation. A combination of five bits in the DPD encoding (leftmostcolumn) vwxst are used to specify a translation to the 3-digit BCDencoding. Dashes (-) in the table are don't cares, and can be either oneor zero.

Thus, in the DPD format, the least significant bit y of the DPD formatis the same as the least significant bit m of the BCD digit that formedthe DPD digit. Therefore, if the least significant digit of a BCD numberis 0000, the least significant bit of the DPD encoding m is 0. Thisprovides a useful characteristic for the present invention. If a DPDformat operation is performed such as multiply, an intermediate resultis produced. The intermediate result having a high order portion thatconforms to a hardware format, and a low order portion. When the resultis rounded, only the high order portion is saved. If the leastsignificant decimal digit D (represented as a BCD digit) of the highorder portion is 0, it will be necessary to know whether the value V ofthe low order portion was 0. If V was exactly 0, the high order portionis said to be exact. If the value V of the low order portion is not 0,the high order portion is inexact since one can't tell from the highorder portion alone whether the least significant digit exactlyrepresents the value that would have included the low order portion ornot. The present invention, in a round-for-reround mode of operation,determines if the value V of the low order portion is not zero and ifthe low order bit p of the least significant BCD digit D in either BCDor DPD format of the high order portion is 0. If both are true, the loworder bit p is changed to p′=1 to indicate that the least significantdigit is not 0. This indicator, permits later rounding to D−2 digits orless. Rounding to D−1 digits would further require an exact/inexactindicator for a least significant digit of 5 which is not necessary forthe rounding to D−2 or less.

In the case of a BID encoding, the coefficient is coded as a binaryinteger. Thus it would be very difficult to provide round for reround tothe D−1 digit since in a binary integer, the whole integer would have tobe analyzed to determine of the least significant digit D of the highorder portion was 5. However in the BID encoding the least significantbit is directly indicative of if the least significant digit D itrepresents any even value including a decimal 0. Thus, in BID format themechanism of setting the least significant bit p of the high orderportion to a 1 when the both the least significant bit of the high orderportion was 0 and the low order portion was not 0 provides a resultantleast significant digit D′ that only has a decimal value of 0 when it isexactly 0. This permits later rerounding to D−2 digits or less.

The present invention provides a round-for-reround mode for BID encodingby detecting that the encoded least significant bit p is 0 of the mostsignificant portion of the intermediate result and testing that bits p+1to n of the least significant portion are not all 0's. When this is thecase, the p bit is changed to p′=1 indicating the coefficient isnon-exact in the case where the least significant decimal digit of theintermediate result represented by the BID encoding was 0 since thechange of p to p′ changes the corresponding least significant digit to adecimal 1.

In one embodiment, the round-for-reround operation is performed after anadditional step of pre-rounding to the hardware precision having Ddecimal digits using a specified pre-rounding mode.

A second alternate to the proposed invention is to maintain a registerfile with additional tag bits. It is common in both PowerPC from IBMcorp. and INTEL implementations to maintain a bit(s) of additionalinformation in storage associated with Floating Point Registers but thisinformation has been limited to special number detection (exponent allzero or all ones, fraction all zero or all ones, NaN, Infinity, Zero, oreven the implicit integer coefficient bit). In an embodiment of thepresent invention, 1 or 2 additional bits (pF tags) of information aremaintained consisting of preferably an inexact bit e and an indicator gof whether a guard digit would be equal to 5 or more. The inexact bitdoes not include the guard digit half or more if present. The arithmeticoperation is rounded to zero (truncation) to D digits and the D digitsare written to the register file with the additional 1 or 2 tag bits.With 2 tag bits a subsequent Reround instruction could be designed toaccurately round to any rounding mode up to D digits. With 1 tag bit(the inexact tag) the subsequent Reround instruction could be designedto accurately round to any rounding mode to D−1 digits, since a priorresult can not be determined to be exactly halfway between tworepresentations. Note that 1 tag bit will accurately round directionally(to plus or minus infinity) to D digits.

The present invention includes the concept of:

1) a new rounding mode which logically ORs the sticky bit (representingthe value of the least significant portion was greater than 0) to theleast significant bit of coefficient coupled with a Reround instruction.

2) maintaining 1 inexact tag bit per FPR on arithmetic operationscoupled with a Reround instruction utilizing the tag bit. The tag bitwould preferably be saved in a register associated with the FloatingPoint Register (FPR) that stores the resulting decimal floating pointnumber. Each FPR of the plurality of FPRs would have an associated tagregister.

3) maintaining 2 tag bits comprising a guard halfway or above bit, andan inexact bit excluding halfway indication. The tag bits wouldpreferably be saved in a register associated with the Floating PointRegister (FPR) that stores the resulting decimal floating point number.Each FPR of the plurality of FPRs would have an associated tag register.

All of 1) through 3) are systems to achieve the equivalent of 1 roundingerror even though the rounding is first performed to D digits on anarithmetic operation and then is subsequently, but possibly separated intime to allow out of order execution, rounded to a target variableprecision which is less than or equal to D digits. These systems arevery important in Decimal Floating-Point Arithmetic to avoid designingthe complexity into every arithmetic instruction to force it to round tovariable precision.

The present invention can be applied to other floating point formats,including but not limited to Hexadecimal, Binary or packed decimal.

Referring to FIG. 4, in an embodiment, a Decimal Floating Pointinstruction is fetched and executed in a machine implementing aplurality of floating point registers. The instruction includes anopcode field and register fields for locating operands. The instructionis decoded 402 and the location of operands is determined. Also, theoperation is to be performed on the operands, what rounding mode to useand where to store the result of the operation is also determined by anymeans known in the art. The execution unit fetches the operands 403 andperforms the instruction specified operation 404 on the operands 403,the operation in one embodiment is any one of a Multiply, a fusedMultiply-and-Add, a Divide, a Convert to BCD, a Convert from BCD, an Addor a Subtract. The format of the coefficient of the operand ispreferable BID but may also be any of DPD, binary, hexadecimal, BCD andthe like. As a result of the operation, an intermediate result 401 isformed having n bits representing a decimal coefficient. Theintermediate result 401 has a most significant portion of p bits, wherethe p-th bit is the least significant bit of the most significantportion. The intermediate result 401 further comprising a leastsignificant portion (bits (p+1)−n) which will be discarded.

In one embodiment referring to FIG. 5, the round-for-reround mode formsa to-be-stored result 501 consisting of the Most Significant Portion ofthe intermediate result. The to-be-stored result 501 is an encoded valueof a decimal result 503 having D decimal digits. The to-be-stored resultcomprises the value of bit p as a p′ bit except that if 502 the value ofthe least significant portion was greater than 0 the p′ bit is set to 1.

Referring to FIG. 6, an example embodiment of a Decimal reroundinstruction operation is shown. The instruction comprises an opcode, fordetermining a target precision for performing the reround operation anda register field for locating a storage location for storing the result.Preferably the storage location is a Floating Point Register of aplurality of Floating Point Registers. The instruction is fetched anddecoded to determine that it is a reround instruction. The targetprecision D″ is obtained 602 which is the precision that will be appliedto the source operand (for Decimal Floating Point, D is a number ofDecimal digits 503 corresponding to the p′ bit encoded value 501 of theoperand. The source operand 501 is fetched 603, the source operand 501being the to-be-stored result stored by a previously executed Decimalinstruction having the round-for-reround mode. The source operand isthen rounded to the precision D″ (where D″ is less than D) specifiedusing a specified rounding mode where the number of bits of the encodedresult is the encoded value of the decimal result 605 having D″ digits.This embodiment of the reround instruction applied to a BID or DPD formof Decimal Floating Point number, must reround the source operand to adecimal precision D″ having at least 2 less decimal digits than thesource operand D since there is no indication that the least significantdigit is a 5 or not. Since the exact/inexact information is encoded inthe operand, intervening instructions not affecting the operand do notaffect the use of the subsequent reround instruction.

In another embodiment, referring to FIG. 7, the intermediate result ofthe Decimal Instruction is tested as before 502. However, instead ofmodifying the least significant digit of the to-be-stored result, a flag(pF) is set in a flag register 705 (of a plurality m of flag registers703) associated with the floating point register 704 storing the result501. In the embodiment, there is a flag register 705 associated witheach FPR 704 of the plurality m of FPRs 702. In one embodiment, the flagwhen set indicates that the corresponding result low order bit was 0 andthe trailing bits were not all 0's. In another implementation, the flagwhen set indicates that the low order digit of the result was 0 or 5having trailing bits all 0's. in another implementation, an additionalflag bit indicates if the trailing digits consisted of 5 as the mostsignificant digit indicating a halfway-and-above trailer vaue.

Referring to FIG. 8, a reround instruction gets a target precision 802D″ and a rounding mode to be used and gets 801 the source operand 501previously stored. The reround instruction gets 804 the pF flag. Thereround instruction rounds 803 the source operand 501 to the precisionD″ according to the obtained 802 rounding mode. The result 601 encodeddecimal 805 is saved preferably in a Floating Point Register. Thisembodiment of the reround instruction applied to a BID or DPD form ofDecimal Floating Point number, can reround the source operand to adecimal precision having 1 or more fewer decimal digits than the sourceoperand (if the pF flag indicates the least significant digit of thesource operand is 0 or 5 and the least significant portion of theintermediate result was greater than 0).

We have shown conceptually how to implement what we have in a preferredembodiment implemented in a computer which can effectively be used in acommercial implementation of computer architected decimal instructionformat the instructions are used by programmers, usually today “C”programmers. These instruction formats stored in the storage medium maybe executed natively in a Z/Architecture IBM Server, or alternatively inmachines executing other architectures. They can be emulated in theexisting and in future IBM mainframe servers and on other machines ofIBM (e.g. pSeries Servers and xSeries Servers). They can be executed inmachines running Linux on a wide variety of machines using hardwaremanufactured by IBM, Intel, AMD, Sun Microsystems and others. Besidesexecution on that hardware under a Z/Architecture, Linux can be used aswell as machines which use emulation by Hercules, UMX, FXI or PlatformSolutions, where generally execution is in an emulation mode. Inemulation mode the specific instruction being emulated is decoded, and asubroutine built to implement the individual instruction, as in a “C”subroutine or driver, or some other method of providing a driver for thespecific hardware as is within the skill of those in the art afterunderstanding the description of the preferred embodiment. Varioussoftware and hardware emulation patents including, but not limited toU.S. Pat. No. 5,551,013 for a “Multiprocessor for hardware emulation” ofBeausoleil et al., and U.S. Pat. No. 6,009,261: Preprocessing of storedtarget routines for emulating incompatible instructions on a targetprocessor” of Scalzi et al; and U.S. Pat. No. 5,574,873: Decoding guestinstruction to directly access emulation routines that emulate the guestinstructions, of Davidian et al; U.S. Pat. No. 6,308,255: Symmetricalmultiprocessing bus and chipset used for coprocessor support allowingnon-native code to run in a system, of Gorishek et al; and U.S. Pat. No.6,463,582: Dynamic optimizing object code translator for architectureemulation and dynamic optimizing object code translation method ofLethin et al; and U.S. Pat. No. 5,790,825: Method for emulating guestinstructions on a host computer through dynamic recompilation of hostinstructions of Eric Traut; and many others, illustrate the a variety ofknown ways to achieve emulation of an instruction format architected fora different machine for a target machine available to those skilled inthe art, as well as those commercial software techniques used by thosereferenced above.

These Decimal instructions are executed in hardware by a processor or byemulation of said instruction set by software executing on a computerhaving a different native instruction set.

While the preferred embodiment of the invention has been illustrated anddescribed herein, it is to be understood that the invention is notlimited to the precise construction herein disclosed, and the right isreserved to all changes and modifications coming within the scope of theinvention as defined in the appended claims.

What is claimed is:
 1. A computer implemented method for rounding adecimal floating point number to a lesser precision in a computerprocessor, the method comprising: a) executing, by a computer processoroperating natively in non-emulation mode, a decimal floating pointinstruction to perform a decimal floating point operation utilizing around-for-reround mode, the executing comprising: fetching from computerprocessor storage, by the computer processor, a decimal floating pointoperand having a first number of bits representing a first decimalnumber, the first decimal number having a first number of decimal digitsof precision; performing in the round-for-reround mode, by the computerprocessor, the decimal floating point operation on the decimal floatingpoint operand to produce an intermediate result, the intermediate resultconsisting of a high order portion and a to-be-discarded low orderportion, the high order portion consisting of a second number of bitsrepresenting a second decimal number, the second decimal number having aleast significant decimal digit, the low order portion having a thirdnumber of bits; based on the to-be-discarded low order portionrepresenting a greater-than-0 decimal value, causing the leastsignificant decimal digit to not have a 0 value by setting the leastsignificant bit of the high order portion to 1, wherein the leastsignificant decimal digit having a 0 decimal value indicates the seconddecimal number is exact; and storing in computer processor storage, bythe computer processor, the high order portion as a final result of theexecuted decimal floating point operation; and b) subsequent toexecuting the decimal floating point instruction, executing, by thecomputer processor operating in emulation mode, a decimal reroundinstruction, the decimal reround instruction configured to round adecimal floating point number to a designated decimal rounding precisionof a plurality of decimal rounding precisions, the executing of thedecimal reround instruction comprising: fetching from computer processorstorage, by the computer processor, the stored final result of theexecuted decimal floating point operation, the fetched final resulthaving the second number of bits representing the second number ofdecimal digits; determining a decimal reround instruction specifiedsecond rounding precision of the plurality of rounding precisions, thesecond rounding precision having at least 2 fewer decimal digits thanthe first number of decimal digits; rounding, by the computer processor,the fetched final result to a rounded result, the rounded resultrepresenting a decimal number having the at least 2 fewer decimal digitsthan the first number of decimal digits; and storing in computerprocessor storage, by the processor, the rounded final result as aresult of the execution of the decimal reround instruction.
 2. Thecomputer implemented method according to claim 1, wherein a leastsignificant decimal digit having a decimal value greater than 0 does notindicate the second decimal number is exact and does not indicate theto-be-discarded low order portion represents a 0 decimal value.
 3. Thecomputer implemented method according to claim 1, wherein the executing,by the computer processor, the decimal floating point instructionconfigured to perform a decimal floating point operation utilizing around-for-reround mode is configured to support execution of asubsequent alternative reround instruction for rounding, by the computerprocessor, the fetched final result to an alternative rounded result,the alternative rounded result representing a decimal number having 1fewer decimal digits than the first number of decimal digits, whereinbased on the to-be-discarded low order portion representing agreater-than-0 decimal value and the least significant decimal digithaving a 5 decimal value, causing the least significant decimal digit tonot have a 5, wherein the least significant decimal digit having a 5decimal value indicates the second decimal number is exact.
 4. Thecomputer implemented method according to claim 1, wherein the executing,by a computer processor, the decimal floating point instructionconfigured to perform the decimal floating point operation utilizing around-for-reround mode, further comprises pre-rounding, by the computerprocessor, the high order portion according to a pre-round mode, whereinthe pre-rounding mode comprises any one of round toward 0, round awayfrom 0, round toward +infinity, round toward −infinity, round to nearestwith ties to even, round to nearest with ties toward 0 and round tonearest with ties away from
 0. 5. The computer implemented methodaccording to claim 1, wherein operands of the decimal floating pointoperation consist of encoded forms of decimal coefficients, whereindecimal coefficients of encoded forms consist of any one of a binaryinteger decimal (BID) encoding and a densely packed decimal (DPD)encoding.
 6. The computer implemented method according to claim 1,wherein the executed decimal floating point operation consists of anyone of a Multiply, a fused Multiply-and-Add, a Divide, a Convert to BCD,a Convert from BCD, an Add and a Subtract.
 7. A computer system forrounding a decimal floating point number to a lesser precision, thecomputer system comprising: a computer processor comprising: aninstruction fetching unit for fetching instructions to be executed; afloating point arithmetic unit for executing floating point operationsfor executing fetched floating point instructions; and an operandstorage in communication with said floating point arithmetic unit; and amemory communicatively coupled to said computer processor, the computersystem configured to perform a method comprising: a) executing, by thecomputer processor operating natively in non-emulation mode, a decimalfloating point instruction to perform a decimal floating point operationutilizing a round-for-reround mode, the executing comprising: fetchingfrom computer processor storage, by the computer processor, a decimalfloating point operand having a first number of bits representing afirst decimal number, the first decimal number having a first number ofdecimal digits of precision; performing in the round-for-reround mode,by the computer processor, the decimal floating point operation on thedecimal floating point operand to produce an intermediate result, theintermediate result consisting of a high order portion and ato-be-discarded low order portion, the high order portion consisting ofa second number of bits representing a second decimal number, the seconddecimal number having a least significant decimal digit, the low orderportion having a third number of bits; based on the to-be-discarded loworder portion representing a greater-than-0 decimal value, causing theleast significant decimal digit to not have a 0 value by setting theleast significant bit of the high order portion to 1, wherein the leastsignificant decimal digit having a 0 decimal value indicates the seconddecimal number is exact; and storing in computer processor storage, bythe computer processor, the high order portion as a final result of theexecuted decimal floating point operation; and b) subsequent toexecuting the decimal floating point instruction, executing, by thecomputer processor operating in emulation mode, a decimal reroundinstruction, the decimal reround instruction configured to round adecimal floating point number to a designated decimal rounding precisionof a plurality of decimal rounding precisions, the executing the decimalreround instruction comprising: fetching from computer processorstorage, by the computer processor, the stored final result of theexecuted decimal floating point operation, the fetched final resulthaving the second number of bits representing the second number ofdecimal digits; determining a decimal reround instruction specifiedsecond rounding precision of the plurality of rounding precisions, thesecond rounding precision having at least 2 fewer decimal digits thanthe first number of decimal digits; rounding, by the computer processor,the fetched final result to a rounded result, the rounded resultrepresenting a decimal number having the at least 2 fewer decimal digitsthan the first number of decimal digits; and storing in computerprocessor storage, by the processor, the rounded final result as aresult of the execution of the decimal reround instruction.
 8. Thecomputer system according to claim 7, wherein a least significantdecimal digit having a decimal value greater than 0 does not indicatethe second decimal number is exact and does not indicate theto-be-discarded low order portion represents a 0 decimal value.
 9. Thecomputer system according to claim 7, wherein the executing, by thecomputer processor, the decimal floating point instruction configured toperform a decimal floating point operation utilizing a round-for-reroundmode is configured to support execution of a subsequent alternativereround instruction for rounding, by the computer processor, the fetchedfinal result to an alternative rounded result, the alternative roundedresult representing a decimal number having 1 fewer decimal digits thanthe first number of decimal digits, wherein based on the to-be-discardedlow order portion representing a greater-than-0 decimal value and theleast significant decimal digit having a 5 decimal value, causing theleast significant decimal digit to not have a 5, wherein the leastsignificant decimal digit having a 5 decimal value indicates the seconddecimal number is exact.
 10. The computer system according to claim 7,wherein the executing, by a computer processor, the decimal floatingpoint instruction configured to perform the decimal floating pointoperation utilizing a round-for-reround mode, further comprisespre-rounding, by the computer processor, the high order portionaccording to a pre-round mode, wherein the pre-rounding mode comprisesany one of round toward 0, round away from 0, round toward +infinity,round toward −infinity, round to nearest with ties to even, round tonearest with ties toward 0 and round to nearest with ties away from 0.11. The computer system according to claim 7, wherein operands of thedecimal floating point operation consist of encoded forms of decimalcoefficients, wherein decimal coefficients of encoded forms consist ofany one of a binary integer decimal (BID) encoding and a densely packeddecimal (DPD) encoding.
 12. The computer system according to claim 7,wherein the executed decimal floating point operation consists of anyone of a Multiply, a fused Multiply-and-Add, a Divide, a Convert to BCD,a Convert from BCD, an Add and a Subtract.
 13. A computer programproduct for rounding a decimal floating point number to a lesserprecision in a computer processor, the computer program productcomprising a computer readable storage medium having programinstructions embodied therewith, wherein the computer readable storagemedium is not a transitory signal per se, the program instructionsexecutable by a computer processor to cause the computer processor toperform a method comprising: a) executing, by the computer processoroperating natively in non-emulation mode, a decimal floating pointinstruction to perform a decimal floating point operation utilizing around-for-reround mode, the executing comprising: fetching from computerprocessor storage, by the computer processor, a decimal floating pointoperand having a first number of bits representing a first decimalnumber, the first decimal number having a first number of decimal digitsof precision; performing in the round-for-reround mode, by the computerprocessor, the decimal floating point operation on the decimal floatingpoint operand to produce an intermediate result, the intermediate resultconsisting of a high order portion and a to-be-discarded low orderportion, the high order portion consisting of a second number of bitsrepresenting a second decimal number, the second decimal number having aleast significant decimal digit, the low order portion having a thirdnumber of bits; based on the to-be-discarded low order portionrepresenting a greater-than-0 decimal value, causing the leastsignificant decimal digit to not have a 0 value by setting the leastsignificant bit of the high order portion to 1, wherein the leastsignificant decimal digit having a 0 decimal value indicates the seconddecimal number is exact; and storing in computer processor storage, bythe computer processor, the high order portion as a final result of theexecuted decimal floating point operation; and b) subsequent toexecuting the decimal floating point instruction, executing, by thecomputer processor operating in emulation mode, a decimal reroundinstruction, the decimal reround instruction configured to round adecimal floating point number to a designated decimal rounding precisionof a plurality of decimal rounding precisions, the executing the decimalreround instruction comprising: fetching from computer processorstorage, by the computer processor, the stored final result of theexecuted decimal floating point operation, the fetched final resulthaving the second number of bits representing the second number ofdecimal digits; determining a decimal reround instruction specifiedsecond rounding precision of the plurality of rounding precisions, thesecond rounding precision having at least 2 fewer decimal digits thanthe first number of decimal digits; rounding, by the computer processor,the fetched final result to a rounded result, the rounded resultrepresenting a decimal number having the at least 2 fewer decimal digitsthan the first number of decimal digits; and storing in computerprocessor storage, by the processor, the rounded final result as aresult of the execution of the decimal reround instruction.
 14. Thecomputer program product according to claim 13, wherein the leastsignificant decimal digit having a decimal value greater than 0 does notindicate the second decimal number is exact and does not indicate theto-be-discarded low order portion represents a 0 decimal value.
 15. Thecomputer program product according to claim 13, wherein the executing,by the computer processor, the decimal floating point instructionconfigured to perform a decimal floating point operation utilizing around-for-reround mode is configured to support execution of asubsequent alternative reround instruction for rounding, by the computerprocessor, the fetched final result to an alternative rounded result,the alternative rounded result representing a decimal number having 1fewer decimal digits than the first number of decimal digits, whereinbased on the to-be-discarded low order portion representing agreater-than-0 decimal value and the least significant decimal digithaving a 5 decimal value, causing the least significant decimal digit tonot have a 5, wherein the least significant decimal digit having a 5decimal value indicates the second decimal number is exact.
 16. Thecomputer program product according to claim 13, wherein the executing,by a computer processor, the decimal floating point instructionconfigured to perform the decimal floating point operation utilizing around-for-reround mode, further comprises pre-rounding, by the computerprocessor, the high order portion according to a pre-round mode, whereinthe pre-rounding mode comprises any one of round toward 0, round awayfrom 0, round toward +infinity, round toward −infinity, round to nearestwith ties to even, round to nearest with ties toward 0 and round tonearest with ties away from
 0. 17. The computer program productaccording to claim 13, wherein operands of the decimal floating pointoperation consist of encoded forms of decimal coefficients, whereindecimal coefficients of encoded forms consist of any one of a binaryinteger decimal (BID) encoding and a densely packed decimal (DPD)encoding.
 18. The computer program product according to claim 13,wherein the executed decimal floating point operation consists of anyone of a Multiply, a fused Multiply-and-Add, a Divide, a Convert to BCD,a Convert from BCD, an Add and a Subtract.